/**
 *  @file sinusoidalController.cpp
 *
 *  @date 22-dec-2009
 *  @author Ives van der Flaas
 */

#include <cmath>
#include <iostream>
#include "sinusoidalController.h"


namespace si
{

SinusoidalController::SinusoidalController(
		const Vector2 startPos,
		const double vSpeed,
		const double sweepWidth,
		Vector2 size):
	Controller(startPos,size),
	fVerticalSpeed(vSpeed),
	fSweepWidth(sweepWidth),
	fTotalTime(0),
	fStartXpos(startPos.getX())
{


}
void SinusoidalController::update(const double time)
{
	fTotalTime += time;

	fPosition.setY(fPosition.getY() + fVerticalSpeed*time);
	fPosition.setX(fStartXpos + fSweepWidth*cos(fTotalTime));
}
SinusoidalController::~SinusoidalController()
{
	// TODO Auto-generated destructor stub
}

}
